<?php


/**
 * 解析第三方产品 为本地产品
 * createtime:2017/08/12
 * updatetime:2017/08/22
 *  * Created by wzb.
 */
class AnalyProduct
{
	public $db;

	public $DB;


	function __construct()
	{
		$this->DB = new DB();
	}


	/**
	 * [Getpruductdetial  获取 订单产品的详细信息]
	 * @param [type] $sku             [description]
	 * @param [type] $options_id      [description]
	 * @param [type] $increment_id    [description]
	 * @param [type] $pice_or_lotnums [description]
	 * @param [type] $store_id        [description]
	 * @param [type] $item_id         [description]
	 * @param [type] $item_price      [description]
	 * @return bool
	 */
	public function Getpruductdetial(
		$sku, $options_id, $increment_id, $pice_or_lotnums, $store_id, $item_id, $item_price, $db
	)
		//WT360W {10332:126474,10333:126474,10334:126478} R000030229 1 2 20076 182.7 $this->db
	{
		$this->db = $db;
		//定义数组
		$zuzhuangarrary = [];
		$zuzhuangarrary['increment_id'] = $increment_id;
		//$zuzhuangarrary['amount'] = $item_price;//子订单金额
		//通过组装的产品标示 storeid_sku 获取产品
		$storeid_sku = $store_id . '-' . $sku; //2-WT360W
		print_r("sku:" . $storeid_sku);
		echo "||||||||||||||||||||||||---from localhost sync data---|||||||||||||||||||||||\n";
		$product_info = "select * from dlz_product_attr_$store_id where storeid_sku='$storeid_sku' order by id desc";
		// $product_info = "select * from dlz_product_attr where storeid_sku='$storeid_sku'";
		$query_product = $this->db->query($product_info);//返回影响了多少行数据
		$rows_product = $query_product->fetch();
		echo '<pre>'; print_r(["dlz_product_attr_$store_id"=>$product_info]); echo '</pre>';
		$zuzhuangarrary['product_id'] = $rows_product['product_id'];//产品id 25578
		$category = $rows_product['attribute_set_id'];//类目
		//$zuzhuangarrary['category'] = $category;
		$price = $rows_product['price'];//产品基价
		//$amount = "$item_price" - "$price";
		$zuzhuangarrary['amount'] = $price;//子订单金额
		$zuzhuangarrary['productCount'] = $pice_or_lotnums;//数量
		$zuzhuangarrary['status'] = $rows_product['status'];//产品状态
		$zuzhuangarrary['created_at'] = $rows_product['created_at'];//产品上传时间
		$zuzhuangarrary['updated_at'] = $rows_product['updated_at'];//产品修改时间
		$zuzhuangarrary['weight'] = $rows_product['weight'];//产品重量
		$zuzhuangarrary['color'] = $rows_product['color'];//颜色
		$zuzhuangarrary['grade'] = $rows_product['grade'];//等级
		$zuzhuangarrary['texture'] = $rows_product['texture'];//花型
		$zuzhuangarrary['length_option_id'] = $rows_product['length_option_id'];//处理3+1
		$zuzhuangarrary['laceSize'] = $rows_product['lace_size'];//lace尺寸
		$zuzhuangarrary['density'] = $rows_product['density'];//密度
		$zuzhuangarrary['capSize'] = $rows_product['size'];//大小
		$zuzhuangarrary['memo'] = $rows_product['wig_type'];//备注
		$items_package = $rows_product['items_package'];//打包方式
		$country_type_value = $rows_product['country_type'];//国家

		//处理3+1 新的格式解析
		$Length = $rows_product['length_option_id'];
		/***重要的地方尺寸处理***/
		//WIG  Stretched_inc_option_id
		//解析json key=option_id  value=option_value
		$option_arr = json_decode($options_id);
		//{"13573":"161212","13574":"161238","13575":"161239"}
		echo "$options_id\n";
		$firstproduct = [];
		//解析是否是多条3+1 新组合
		if (!empty($Length)) {//13253
			echo "：是新品3+1 组合\n";
			echo '<pre>'; print_r($rows_product); echo '</pre>';
			$isDuotiao = TRUE;
			$Closure = $Length;
			$Stretched = NULL;
		} else {
			echo "：不是新品3+1 组合\n";
			$isDuotiao = FALSE;
			$Closure = $rows_product['Closure_inch_option_id'];
			$Stretched = $rows_product['Stretched_inc_option_id'];
		}
		$part_design = $rows_product['part_design_option_id'];

		foreach ($option_arr as $optionkey => $optionvalue) {
			//产品一

			if (empty($Closure) && empty($Stretched)) {//13253 and null
				echo "Closure:$Closure.Stretched:$Stretched.数据不完整，跳出\n";
				continue;
			}
			$country_type = $rows_product['country_type_option_id'];//空
			$density = $rows_product['density_option_id'];//空
			$color = $rows_product['color_option_id'];//空
			$storeid_sku_value = $store_id . '-' . $sku . '-' . $optionvalue;
			echo "< Closure: $Closure; Stretched:$Stretched; storeid:$storeid_sku_value; color:$color country_type:$country_type;density:$density; part_design:$part_design; optionkey:$optionkey>\n";
			//判定订单产品中的option 与  已同步产品中的option ，存在则找到相关信息
			if ($Closure == $optionkey) {//25540 ==238458 238479 238484
				if (!$isDuotiao) {//非3+1-----------------------
					$firstproduct['P1']['closure'] = $this->getoptionvalue($table_ = "dlz_product_closureinch",
						$storeid_sku_value);
				} else {//3+1
					$duotiaolength = $this->getoptionvalue($table_ = "dlz_product_length", $storeid_sku_value);
					$duo_inc_arr = explode('&', $duotiaolength);//是否是3+1 拆分
					$str_duo = $duo_inc_arr[1];//获取字符串
					$recode_inc = $this->findNum($str_duo);//提取数字
					$firstproduct['P1']['closure'] = $recode_inc;
				}
				//$lotNum = '1';
				$firstproduct['P1']['lotNum'] = '1';//打包条数
			}
			if ($Stretched == $optionkey) {
				$firstproduct['P1']['Stretched'] = $this->getoptionvalue($table_ = "dlz_product_stretchedinc",
					$storeid_sku_value);
				$firstproduct['P1']['lotNum'] = '1';//打包条数
			}
			if ($part_design == $optionkey) {
				$firstproduct['P1']['hairDesign'] = $this->getoptionvalue($table_ = "dlz_product_partdesign",
					$storeid_sku_value);
			}
			if ($country_type == $optionkey && (!empty($Closure) || !empty($Stretched))) {
				$firstproduct['P1']['type_country'] = $this->getoptionvalue($table_ = "dlz_product_countrytype",
					$storeid_sku_value);

			}
			if ($density == $optionkey) {
				//2017/11/1
				$firstproduct['P1']['density'] = $this->getoptionvalue($table_ = "dlz_product_density",
					$storeid_sku_value);
				/**密度变为可选项 功能过渡判断*/
				if (empty($firstproduct['P1']['density']) || $firstproduct['P1']['density'] == '') {
					$firstproduct['P1']['density'] = $rows_product['density'];//密度
				}
			}
			if ($color == $optionkey) {
				//2019.04.13
				$firstproduct['P1']['color'] = $this->getoptionvalue($table_ = "dlz_product_color", $storeid_sku_value);
				/**颜色变为可选项 功能过渡判断*/
				if (empty($firstproduct['P1']['color']) || $firstproduct['P1']['color'] == '') {
					$firstproduct['P1']['color'] = $rows_product['color'];//
				}

			}

		}
		echo "< p1 insert >\n";
		if (!empty($firstproduct)) {
			$this->insertsql($zuzhuangarrary, $get_param = $firstproduct, $category, $country_type_value, $item_id);
		}

		$secondproduct = [];
		foreach ($option_arr as $optionkey2 => $optionvalue2) {
			//产品二
			$storeid_sku_value = $store_id . '-' . $sku . '-' . $optionvalue2;
			if (!$isDuotiao) {//no
				$Weft = $rows_product['Weft_inc_option_id'];
			} else {//3+1
				$Weft = $rows_product['length_option_id'];
			}
			echo '<pre>'; print_r(['Weft'=>$Weft]); echo '</pre>';
			if (empty($Weft)) {
				continue;
			}
			$country_type = $rows_product['country_type_option_id'];
			$color = $rows_product['color_option_id'];//2019/04/13
			echo '<pre>'; print_r(['Weft'=>$Weft,'optionkey2'=>$optionkey2]); echo '</pre>';
			if ($Weft == $optionkey2) {
				if (!$isDuotiao) {//3+1
					$secondproduct['P2']['weaving'] = $this->getoptionvalue($table_ = "dlz_product_weftinc",
						$storeid_sku_value);
					echo '正向正'. $secondproduct['P2']['weaving'];
				} else {//非3+1
					$duotiaolength2 = $this->getoptionvalue($table_ = "dlz_product_length", $storeid_sku_value);
					echo '<pre>'; var_dump(['dlz_product_length'=>$duotiaolength2]); echo '</pre>';
					$duo_inc_arr2 = explode('&', $duotiaolength2);//是否是3+1 拆分
					$str_duo2 = $duo_inc_arr2[0];//获取字符串
					$secondproduct['P2']['weaving'] = $str_duo2;
					echo '正向反'. $secondproduct['P2']['weaving'];
				}

				$lotNum = '1';
				$secondproduct['P2']['lotNum'] = $lotNum;//打包条数
			}

			if ($country_type == $optionkey2 && !empty($Weft)) {
				$secondproduct['P2']['type_country'] = $this->getoptionvalue($table_ = "dlz_product_countrytype",
					$storeid_sku_value);
				echo '<pre>'; var_dump(['dlz_product_countrytype'=>$secondproduct['P2']['type_country']]); echo '</pre>';
			}
			if ($color == $optionkey2) {
				//2019.04.13
				$secondproduct['P2']['color'] = $this->getoptionvalue($table_ = "dlz_product_color",
					$storeid_sku_value);
				echo '<pre>'; var_dump(['dlz_product_color'=>$secondproduct['P2']['color']]); echo '</pre>';
				/**颜色变为可选项 功能过渡判断*/
				if (empty($secondproduct['P2']['color']) || $secondproduct['P2']['color'] == '') {
					$secondproduct['P2']['color'] = $rows_product['color'];//
				}

			}

			echo "<Weft:" . $Weft . $storeid_sku_value . $optionkey2 . ">\n";
		}
		echo "< p2 insert >\n";
		echo '<pre>'; print_r([$firstproduct,$secondproduct]); echo '</pre>';
		if (empty($firstproduct) && empty($secondproduct)) {
			echo "数据为空退出\n";
			return FALSE;
		}
		if (!empty($secondproduct)) {
			$this->insertsql($zuzhuangarrary, $get_param = $secondproduct, $category, $country_type_value, $item_id);
		}

		$var = $this->zuzhuangPostChild($orderid = $increment_id);
//		print_r($var);


		echo "++++++++++++++++++end++++++++++++++++++++\n";
		return TRUE;
	}


	/**
	 * [getoptionvalue 通过组合的sku 获取相应的value]
	 * @param  [type] $table_            [description]
	 * @param  [type] $storeid_sku_value [description]
	 * @return [type]                    [description]
	 */
	public function getoptionvalue($table_, $storeid_sku_value)
	{
		$sql_optionvalue = "select * from $table_ where storeid_sku='$storeid_sku_value'";
		$query_optionvalue = $this->db->query($sql_optionvalue);//返回影响了多少行数据
		$optionvalue_title='';
		while ($rows_optionvalue = $query_optionvalue->fetch()) {
			$optionvalue_title = $rows_optionvalue['title'];
		}
		return $optionvalue_title;
	}


	/**
	 * [insertsql 分别按照 单个 多个子订单进行插入]
	 * @param $zuzhuangarrary
	 * @param $get_param
	 * @param $category
	 * @param $country_type_value
	 * @param $item_id
	 * @internal param $ [type] $zuzhuangarrary     [description]
	 * @internal param $ [type] $get_param          [description]
	 * @internal param $ [type] $category           [description]
	 * @internal param $ [type] $db                 [description]
	 * @internal param $ [type] $country_type_value [description]
	 * @internal param $ [type] $item_id            [description]
	 */
	public function insertsql($zuzhuangarrary, $get_param, $category, $country_type_value, $item_id)
	{
		print_r(['改前'=>$zuzhuangarrary]);
		echo "\n";
		if (isset($get_param['P1'])) {
			$zuzhuangarrary['child_id'] = $zuzhuangarrary['increment_id'] . '-' . $item_id . '-' . '01';
			$zuzhuangarrary['orderit_itemid'] = $zuzhuangarrary['increment_id'] . '-' . $item_id . '-' . '01';
			$type_lacesize = $zuzhuangarrary['laceSize'];
			echo 'laceSize:'.$type_lacesize."\n";
			foreach ($get_param['P1'] as $key_p => $value_p) {
				if ($key_p == "closure" || $key_p == "Stretched") {
					$zuzhuangarrary['inch'] = trim($value_p);
				} else {
					$zuzhuangarrary[$key_p] = trim($value_p);
				}
                if ($type_lacesize == "Full" || $type_lacesize == "Full Lace Frontal Wig") {
                    $zuzhuangarrary['laceSize'] = 'Full lace';
                    $zuzhuangarrary['category'] = "Wigs";
                    $zuzhuangarrary['laceWigType'] = "Full Lace Wigs";
                } elseif ($category == "Hair Weft with Closure" && $type_lacesize == "360") {
                    $zuzhuangarrary['category'] = "Lace Front";
                    $zuzhuangarrary['type'] = "360 Lace Frontal";
                } elseif ($category == "Wig" && $type_lacesize == "360" || $type_lacesize == "360 Lace Frontal Wig") {
                    $zuzhuangarrary['laceWigType'] = "360 lace wig";
                    $zuzhuangarrary['category'] = "Wigs";
                } elseif ($category == "Wig" && $type_lacesize == "360 Transparent" || $type_lacesize == "360 Transparent") {
                    $zuzhuangarrary['laceWigType'] = "Transparent 360 lace wig";
                    $zuzhuangarrary['category'] = "Wigs";
                } elseif ($type_lacesize == "4\" x 4\"") {
                    $zuzhuangarrary['category'] = "Closure";
                    $zuzhuangarrary['type'] = "Lace Closure";
                } elseif ($type_lacesize == "4\" x 13\"") {
                    $zuzhuangarrary['category'] = "Lace Front";
                    $zuzhuangarrary['type'] = "Lace Front";
                } elseif (empty($type_lacesize)) {
                    $zuzhuangarrary['category'] = "Hair Weaving";
                } elseif ($type_lacesize == "Transparent Lace Wig") {
                    $zuzhuangarrary['category'] = "Wigs";
                    $zuzhuangarrary['laceWigType'] = "Transparent 6*13 lace wig";
                } elseif ($type_lacesize == "6\" x 13\"") {
                    $zuzhuangarrary['category'] = "Wigs";
                    $zuzhuangarrary['laceWigType'] = "6*13 lace wig";
                } elseif ($category == "Hair Closure" && $type_lacesize == "360" || trim($type_lacesize) == "360 Lace Frontal") {
                    $zuzhuangarrary['category'] = "Lace Front";
                    $zuzhuangarrary['type'] = "360 Lace Frontal";
                } elseif ($type_lacesize == "6\" x 13\" bob") {
                    $zuzhuangarrary['category'] = "Wigs";
                    $zuzhuangarrary['laceWigType'] = "6*13 lace bob wig";
                }elseif ($type_lacesize == "4*4 Bob Wig") {
                    $zuzhuangarrary['category'] = "Wigs";
                    $zuzhuangarrary['laceWigType'] = "4*4 Bob Wig";
                }elseif ($type_lacesize == "transparent 4*13 lace wig") {
                    $zuzhuangarrary['category'] = "Wigs";
                    $zuzhuangarrary['laceWigType'] = "transparent 4*13 lace wig";
                }elseif ($type_lacesize == "4*4 lace wig") {
                    $zuzhuangarrary['category'] = "Wigs";
                    $zuzhuangarrary['laceWigType'] = "4*4 lace wig";
                } else {
                    $zuzhuangarrary['category'] = "Wigs";
                    $zuzhuangarrary['laceWigType'] = $type_lacesize;
                }

//          }elseif ($type_lacesize == "bob full lace wig") {
//            $zuzhuangarrary['category'] = "Wigs";
//            $zuzhuangarrary['laceWigType'] = "bob full lace wig";
//          }elseif ($type_lacesize == 'T part wig') {
//            $zuzhuangarrary['category'] = "Wigs";
//            $zuzhuangarrary['laceWigType'] = "T part wig";
//          }elseif ($type_lacesize == '5*5 lace wig') {
//            $zuzhuangarrary['category'] = "Wigs";
//            $zuzhuangarrary['laceWigType'] = "5*5 lace wig";
//          }elseif($type_lacesize == "Machine wigs with bang"){
//            $zuzhuangarrary['laceWigType'] = "Machine wigs with bang";
//            $zuzhuangarrary['category'] = "Wigs";
//          }elseif($type_lacesize == "Machine wigs"){
//			  $zuzhuangarrary['laceWigType'] = "Machine wigs";
//			  $zuzhuangarrary['category'] = "Wigs";
//		  }elseif($type_lacesize == "highlight WIG"){
//			  $zuzhuangarrary['laceWigType'] = "highlight WIG";
//			  $zuzhuangarrary['category'] = "Wigs";
//		  }elseif($type_lacesize == "2x5 PU Wig"){
//			  $zuzhuangarrary['laceWigType'] = "2x5 PU Wig";
//			  $zuzhuangarrary['category'] = "Wigs";
//		  }elseif($type_lacesize == "U Part Wig"){
//			  $zuzhuangarrary['laceWigType'] = "U Part Wig";
//			  $zuzhuangarrary['category'] = "Wigs";
//		  }
				if (empty($zuzhuangarrary['type_country'])) {
					$zuzhuangarrary['type_country'] = $country_type_value;
				}

			}
			print_r(['改后'=>$zuzhuangarrary]);
			echo "\n";
			unset($zuzhuangarrary['length_option_id']);
			$result = $this->DB->Getinsert($arrData = $zuzhuangarrary, $table = 'dlz_order_product', $sync_data = "0");
			//给定处理过的产品，用 1 标示；
			if ($result == '0') {
				$syncstatus_sql = "update dlz_attribute_all_id set sync_status='1' where item_id='$item_id'";
				$this->db->exec($syncstatus_sql);
			}

			//
		} elseif (isset($get_param['P2'])) {
			$zuzhuangarrary['child_id'] = $zuzhuangarrary['increment_id'] . '-' . $item_id . '-' . '02';
			$zuzhuangarrary['orderit_itemid'] = $zuzhuangarrary['increment_id'] . '-' . $item_id . '-' . '02';
			foreach ($get_param['P2'] as $key_p1 => $value_p1) {
				echo "$key_p1******\n";
				if ($key_p1 == "weaving") {
					$zuzhuangarrary['inch'] = trim($value_p1);
					$zuzhuangarrary['category'] = "Hair Weaving";
					//$zuzhuangarrary['lotNum'] = $value_p1;
					unset($zuzhuangarrary['laceSize']);
				} else {
					$zuzhuangarrary[$key_p1] = $value_p1;
				}
				if (empty($zuzhuangarrary['type_country'])) {
					$zuzhuangarrary['type_country'] = $country_type_value;
				}
			}
			//print_r($zuzhuangarrary);
			echo "\n";
			unset($zuzhuangarrary['length_option_id']);
			$result = $this->DB->Getinsert($arrData = $zuzhuangarrary, $table = 'dlz_order_product',
				$sync_data = "0");//
			//给定处理过的产品，用 1 标示；
			if ($result == '0') {
				$syncstatus_sql = "update dlz_attribute_all_id set sync_status='1' where item_id='$item_id'";
				$this->db->exec($syncstatus_sql);
			}
		}//


	}


	/**
	 * [zuzhuangPostChild 组装需要推送的子订单信息]
	 * @param  string $orderid [description]
	 */
	public function zuzhuangPostChild($orderid = '')
	{
		$sql_order = "select * from dlz_order_product where option_status='0' and increment_id='$orderid'";
		$query_order = $this->db->query($sql_order);//返回影响了多少行数据
		while ($row_order = $query_order->fetch()) {
			$sql_arrary = [];
			$sql_arrary['increment_id'] = $increment_id = $row_order['increment_id'];
			$child_id = $row_order['child_id'];
			$sql_arrary['product_id'] = $row_order['product_id'];
			$sql_arrary['category'] = $row_order['category'];
			$sql_arrary['status'] = $row_order['status'];
			$sql_arrary['type_id'] = $row_order['type_id'];
			$sql_arrary['created_at'] = $row_order['created_at'];
			$sql_arrary['updated_at'] = $row_order['updated_at'];
			$sql_arrary['weight'] = $row_order['weight'];
			$inch = $row_order['inch'];
			$sql_arrary['color'] = $row_order['color'];
			$sql_arrary['grade'] = $row_order['grade'];
			$sql_arrary['texture'] = $row_order['texture'];
			$sql_arrary['package'] = $row_order['package'];
			$sql_arrary['type_country'] = $row_order['type_country'];
			$sql_arrary['hairDesign'] = $row_order['hairDesign'];
			$sql_arrary['type'] = $row_order['type'];
			$sql_arrary['laceWigType'] = $row_order['laceWigType'];
			$sql_arrary['density'] = str_replace(' Density','',$row_order['density']);
			$sql_arrary['capSize'] = $row_order['capSize'];
			$sql_arrary['laceSize'] = $row_order['laceSize'];
			$sql_arrary['lotNum'] = $row_order['lotNum'];
			$sql_arrary['productCount'] = $row_order['productCount'];
			$sql_arrary['amount'] = $row_order['amount'];
			$sql_arrary['currencyCode'] = $row_order['currencyCode'];
			$orderit_itemid = $row_order['orderit_itemid'];

			$inc_arr = explode(' ', $inch);
			$countnum = count($inc_arr);
			if ("$countnum" > "1") {
				echo "大于1 ：$inch  -";

				for ($index = 0; $index < $countnum; $index++) {
					$sql_arrary['inch'] = $inc_arr[$index];//尺寸
					$sql_arrary['orderit_itemid'] = $orderit_itemid . '-' . $index;//索引
					$sql_arrary['child_id'] = $child_id . '-' . $index;//尺寸
					$result = $this->DB->Getinsert($arrData = $sql_arrary, $table = 'dlz_post_orderinfo',
						$sync_data = "0");
					//如果分解打包尺寸的订单成功，则记录状态
					if ("$result" == '0') {
						$syncstatus_sql = "update dlz_order_product set option_status='1' where child_id='$child_id'";
						$this->db->exec($syncstatus_sql);
					}

				}
			} else {
				echo "小于1 ：$inch";
				$sql_arrary['inch'] = $inch;//尺寸
				$sql_arrary['orderit_itemid'] = $orderit_itemid;//索引
				$sql_arrary['child_id'] = $child_id;//尺寸
				$result = $this->DB->Getinsert($arrData = $sql_arrary, $table = 'dlz_post_orderinfo', $sync_data = "0");
				//如果分解打包尺寸的订单成功，则记录状态
				if ("$result" == '0') {
					$syncstatus_sql = "update dlz_order_product set option_status='1' where child_id='$child_id'";
					$this->db->exec($syncstatus_sql);
				}

			}
			$upd_sql = "update dlz_order_info set issendqm='1' where increment_id='$increment_id'";
			$this->db->exec($upd_sql);
		}
	}


//提取数字
	function findNum($str = '')
	{
		$str = trim($str);
		if (empty($str)) {
			return '';
		}
		$temp = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'];
		$result = '';
		for ($i = 0; $i < strlen($str); $i++) {
			if (in_array($str[$i], $temp)) {
				$result .= $str[$i];
			}
		}
		return $result;
	}

	//尺寸处理 10"Straight+12"Curlyinch  26"+250%Densityinch 两种组合方式
	function inchtext($zuzhuangarrary){
		//Density密度 //hairlength长度 //hairstyle花型
		$inch=$zuzhuangarrary['inch'];//长度
		if(substr_count($inch,'+')>0){
			$stringcount=substr_count($inch,'"');
			if($stringcount==1){
				//26"+250%Densityinch
				$zuzhuangarrary['inch']=$this->get_msg($inch,'','"',1,0)[0];//获得尺寸
				$zuzhuangarrary['density']=$this->get_msg($inch,'+','%',1,0)[0];//获得密度
			}
			if($stringcount==2){
				//尺寸处理 10"Straight+12"Curlyinch
				$inchs=$this->get_msg($inch,'','"',1,0)[0];//尺寸1
				$inchs=$inchs."+";
				$zuzhuangarrary['inch']=$inchs.$this->get_msg($inch,'+','"',1,0)[0];//尺寸2

				//花型
				$location=strpos($inch,'+')+4;
				$texture=$this->get_msg($inch,'"','+',1,0)[0];//花型1;
				$texture=$texture." ";
				$zuzhuangarrary['texture']=$texture.substr($inch,$location,strlen($inch)-$location);//花型2;
			}
		}
		return $zuzhuangarrary;
	}
	/*
*取字符串中间文本
* @param	string	$str	需要处理的字符串
* @param	string 	$start_str 目标字符串‘前’的字符
* @param	string 	$stop_str  目标字符串‘后’的字符
* @param	int 	$count     需要查找的次数
* @param	int 	$n		   从第n个位置开始查找
* @return	array	$data	返回查找满足条件要求的数组字符串
*/
	function  get_msg($str,$start_str,$stop_str,$count,$n){
		$start=$n;  //从第n个位置开始查找
		$data=array();
		for($i=0;$i<$count;$i++){
			$start=strpos($str,$start_str,$start);
			$stop=strpos($str,$stop_str,$start);
			$start=strlen($start_str)+$start;
			$data[$i]= substr($str,$start,$stop-$start);
			$start=$stop;
		}
		return $data;
	}
}
